/**
 */
package de.thwildau.tm.moses.thrift.thrift.impl;

import de.thwildau.tm.moses.thrift.thrift.Annotation;
import de.thwildau.tm.moses.thrift.thrift.FieldType;
import de.thwildau.tm.moses.thrift.thrift.ListType;
import de.thwildau.tm.moses.thrift.thrift.ThriftPackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>List Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.thwildau.tm.moses.thrift.thrift.impl.ListTypeImpl#getListType <em>List Type</em>}</li>
 *   <li>{@link de.thwildau.tm.moses.thrift.thrift.impl.ListTypeImpl#getListTypeAnnotation <em>List Type Annotation</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ListTypeImpl extends ContainerTypeImpl implements ListType
{
  /**
   * The cached value of the '{@link #getListType() <em>List Type</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getListType()
   * @generated
   * @ordered
   */
  protected FieldType listType;

  /**
   * The cached value of the '{@link #getListTypeAnnotation() <em>List Type Annotation</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getListTypeAnnotation()
   * @generated
   * @ordered
   */
  protected Annotation listTypeAnnotation;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ListTypeImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return ThriftPackage.Literals.LIST_TYPE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public FieldType getListType()
  {
    return listType;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetListType(FieldType newListType, NotificationChain msgs)
  {
    FieldType oldListType = listType;
    listType = newListType;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ThriftPackage.LIST_TYPE__LIST_TYPE, oldListType, newListType);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setListType(FieldType newListType)
  {
    if (newListType != listType)
    {
      NotificationChain msgs = null;
      if (listType != null)
        msgs = ((InternalEObject)listType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ThriftPackage.LIST_TYPE__LIST_TYPE, null, msgs);
      if (newListType != null)
        msgs = ((InternalEObject)newListType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ThriftPackage.LIST_TYPE__LIST_TYPE, null, msgs);
      msgs = basicSetListType(newListType, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ThriftPackage.LIST_TYPE__LIST_TYPE, newListType, newListType));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Annotation getListTypeAnnotation()
  {
    return listTypeAnnotation;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetListTypeAnnotation(Annotation newListTypeAnnotation, NotificationChain msgs)
  {
    Annotation oldListTypeAnnotation = listTypeAnnotation;
    listTypeAnnotation = newListTypeAnnotation;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ThriftPackage.LIST_TYPE__LIST_TYPE_ANNOTATION, oldListTypeAnnotation, newListTypeAnnotation);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setListTypeAnnotation(Annotation newListTypeAnnotation)
  {
    if (newListTypeAnnotation != listTypeAnnotation)
    {
      NotificationChain msgs = null;
      if (listTypeAnnotation != null)
        msgs = ((InternalEObject)listTypeAnnotation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ThriftPackage.LIST_TYPE__LIST_TYPE_ANNOTATION, null, msgs);
      if (newListTypeAnnotation != null)
        msgs = ((InternalEObject)newListTypeAnnotation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ThriftPackage.LIST_TYPE__LIST_TYPE_ANNOTATION, null, msgs);
      msgs = basicSetListTypeAnnotation(newListTypeAnnotation, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ThriftPackage.LIST_TYPE__LIST_TYPE_ANNOTATION, newListTypeAnnotation, newListTypeAnnotation));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case ThriftPackage.LIST_TYPE__LIST_TYPE:
        return basicSetListType(null, msgs);
      case ThriftPackage.LIST_TYPE__LIST_TYPE_ANNOTATION:
        return basicSetListTypeAnnotation(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case ThriftPackage.LIST_TYPE__LIST_TYPE:
        return getListType();
      case ThriftPackage.LIST_TYPE__LIST_TYPE_ANNOTATION:
        return getListTypeAnnotation();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case ThriftPackage.LIST_TYPE__LIST_TYPE:
        setListType((FieldType)newValue);
        return;
      case ThriftPackage.LIST_TYPE__LIST_TYPE_ANNOTATION:
        setListTypeAnnotation((Annotation)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ThriftPackage.LIST_TYPE__LIST_TYPE:
        setListType((FieldType)null);
        return;
      case ThriftPackage.LIST_TYPE__LIST_TYPE_ANNOTATION:
        setListTypeAnnotation((Annotation)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ThriftPackage.LIST_TYPE__LIST_TYPE:
        return listType != null;
      case ThriftPackage.LIST_TYPE__LIST_TYPE_ANNOTATION:
        return listTypeAnnotation != null;
    }
    return super.eIsSet(featureID);
  }

} //ListTypeImpl
